fix(updater): Prevent script injection vulnerabilities#98
Merged
Conversation
Add input validation and use environment variables instead of direct interpolation to prevent potential script injection attacks through user-controlled workflow inputs. - Add validate-inputs job to check for safe characters in inputs.name and inputs.path - Move all environment variable declarations to job level for better organization - Replace direct interpolation in PR titles and PowerShell scripts with env variables - Ensure all user inputs are properly sanitized before use 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Split the single validation step into two distinct steps for better clarity and more granular error reporting: - Validate dependency name - Validate dependency path Each step now also logs a success message when validation passes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Fix the regex pattern to properly match spaces in dependency names by using the [:space:] POSIX character class instead of a literal space in the regex pattern. This fixes CI failures for test cases that include spaces in the dependency name like "Workflow args test script". 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Move hyphens to the end of character classes in regex patterns to ensure they are treated as literal characters rather than ranges. This fixes validation failures for inputs containing hyphens like "WORKFLOW-TEST-DEPENDENCY-DO-NOT-MERGE". 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Convert the validation steps from Bash to PowerShell for consistency with the rest of the workflow which uses PowerShell as its default shell. - Use PowerShell's -notmatch operator instead of Bash regex - Use Write-Output instead of echo - Maintain the same validation logic and error messages 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add entry to CHANGELOG.md documenting the security improvements to prevent script injection vulnerabilities in the updater workflow. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
jpnurmi
reviewed
Sep 3, 2025
| run: | | ||
| $mainBranch = $(git remote show origin | Select-String "HEAD branch: (.*)").Matches[0].Groups[1].Value | ||
| $prBranch = switch ('${{ inputs.pr-strategy }}') | ||
| $prBranch = switch ($env:PR_STRATEGY) |
Collaborator
There was a problem hiding this comment.
should this also have double-quotes around?
Contributor
Author
There was a problem hiding this comment.
no because we can just switch directly on the variable value instead of converting it to string (which it is anyway), and actually I don't think we should be quoting in the step above, let me check
Co-authored-by: J-P Nurmi <jpnurmi@gmail.com>
vaind
commented
Sep 3, 2025
vaind
commented
Sep 3, 2025
vaind
commented
Sep 3, 2025
vaind
commented
Sep 3, 2025
jpnurmi
approved these changes
Sep 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevent script injection vulnerabilities in the
updater.ymlworkflow by validating inputs and using environment variables instead of direct interpolation.Security Fixes
validate-inputsjob to ensureinputs.nameandinputs.pathonly contain safe charactersChanges
${{ env.* }}or$env:*instead of direct${{ inputs.* }}Test Results
Fixes potential command injection through crafted workflow inputs.
🤖 Generated with Claude Code